//
//  BanBu_MWNavigationController.m
//  BanBu
//
//  Created by banbu3 on 10/17/13.
//
//

#import "BanBu_MWNavigationController.h"

@interface BanBu_MWNavigationController ()

@end

@implementation BanBu_MWNavigationController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
-(void)viewWillLayoutSubviews
{
    if(IS_IOS_7)
    {
        self.view.frame = CGRectMake(0, 0, 320, 568);
    }
}
- (id)initWithRootViewController:(UIViewController *)rootViewController
{
    self = [super initWithRootViewController:rootViewController];
    
    if(self)
    {
        
        if ([self.navigationBar respondsToSelector:@selector(setBackgroundImage:forBarMetrics:)])
        {
            
            if([[[UIDevice currentDevice] systemVersion] floatValue]>=7.0)
            {
                rootViewController.edgesForExtendedLayout = UIRectEdgeTop;
                rootViewController.extendedLayoutIncludesOpaqueBars = YES;
                rootViewController.modalPresentationCapturesStatusBarAppearance = NO;
                rootViewController.automaticallyAdjustsScrollViewInsets = NO;
            }
 
            self.navigationController.navigationBar.translucent = YES; //让状态栏和导航栏不透明
        }
        
        return self;
    }
    
    return nil;
}

- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated {
    
    if([[[UIDevice currentDevice] systemVersion] floatValue]>=7.0)
    {
//        viewController.edgesForExtendedLayout = UIRectEdgeNone;
//        viewController.extendedLayoutIncludesOpaqueBars = NO;
//        viewController.modalPresentationCapturesStatusBarAppearance = NO;
//        viewController.automaticallyAdjustsScrollViewInsets = NO;
    }
    [super pushViewController:viewController animated:animated];
}
@end
